package com.qw.qrweb.controller;

import com.qw.qrweb.model.api.ApiResponse;
import com.qw.qrweb.service.UserService;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
public class UserController {

    @Resource
    UserService userService;

    @PostMapping("/api/user/login")
    public String login(@RequestParam("username") String username, @RequestParam("password") String password) {
        return userService.login(username, password) ? ApiResponse.ok(username) : ApiResponse.intError();
    }

}
